<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>具名插槽</title>
</head>

<body>
    <div id="app">

    </div>
</body>
<script src="https://unpkg.com/vue@next"></script>
<script>
    const app = Vue.createApp({
    template: `
    <layout-demo>
        <template v-slot:header>
        <h1>This is title</h1>
        </template>
        <template v-slot:default>
        <p>A paragraph for the main content.</P>
    </template>
    <template v-slot:footer>
        <p>Here is some contact info</P>
    </template><
    </layout-demo>
    `
    })
    app.component('layout-demo', {
        template: `
        <div class= "container" >
        <header>
            <slot name="header"></slot>
        </header>
        <main>
            <slot></slot>
        </main>
        <footer>
            <slot name="footer"></slot>
        </footer>
        </div >
`})
    app.mount("#app")
</script>

</html>